package com.weiyuwqj.server.service.user.impl;

import com.weiyuwqj.api.model.BasUserInfo;
import com.weiyuwqj.api.service.BasUserInfoService;
import com.weiyuwqj.server.mapper.BasUserInfoMapper;
import com.weiyuwqj.server.service.base.BaseServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Created by huzj on 2016/8/19.
 */
@Service("userInfoService")
public class BasUserInfoServiceImpl extends BaseServiceImpl<BasUserInfo> implements BasUserInfoService{
    @Autowired
    BasUserInfoMapper userInfoMapper;

    //根据userId查询单条信息
    @Override
    public BasUserInfo getOneByUserId(Integer userId) {
        return userInfoMapper.getOneByUserId(userId);
    }

    //根据userId修改提现限制
    @Override
    public Integer modifyCashLimit(@Param("newStatus") Integer newStatus, @Param("oldStatus") Integer oldStatus, @Param("userId") Integer userId) {
        return userInfoMapper.modifyCashLimit(newStatus, oldStatus, userId);
    }

    //根据userId修改出生地，居住地
    @Override
    public Integer modifyAddressByUserId(BasUserInfo info) {
        return userInfoMapper.modifyAddressByUserId(info);
    }

    @Override
    public void avatarUpload(Integer userId, String url) {
        userInfoMapper.updatePhoto(userId,url);
    }

    @Override
    public void addOpenIdByUserId(Map map) {
        userInfoMapper.addOpenIdByUserId(map);
    }

}
